package com.yxp.webtest.maintest;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Locale;

/**
 * @author      : yang.xp
 * @date        : 2021/10/13 17:10
 * @description : 国际化测测试
 */
public class I18nTest {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-i18n.xml");

        /**
         * 国际化测试
         */
        // ch
        String can = context.getMessage("application-name", new Object[]{}, Locale.CHINESE);
        System.out.println(can);
        String ca = context.getMessage("author", new Object[]{}, Locale.CHINESE);
        System.out.println(ca);
        String cv = context.getMessage("version", new Object[]{}, Locale.CHINESE);
        System.out.println(cv);
        // en
        String ean = context.getMessage("application-name", new Object[]{}, Locale.ENGLISH);
        System.out.println(ean);
        String ea = context.getMessage("author", new Object[]{}, Locale.ENGLISH);
        System.out.println(ea);
        String ev = context.getMessage("version", new Object[]{}, Locale.ENGLISH);
        System.out.println(ev);
        //
        context.close();
    }
}
